﻿<Window x:Class="Convertor.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sm="clr-namespace:Wpf.CommonTools.SystemExtension;assembly=Wpf.CommonTools"
        xmlns:local="clr-namespace:Convertor"
        xmlns:behavior="clr-namespace:Wpf.CommonTools.Behavior;assembly=Wpf.CommonTools"
        xmlns:interface="clr-namespace:Convertor.Interface;assembly=Convertor.Interface"
        xmlns:conv="clr-namespace:Wpf.CommonTools.Converter;assembly=Wpf.CommonTools"
        Title="{DynamicResource AppTitle}" 
        Height="640" Width="1200" 
        WindowStartupLocation="CenterScreen"
        Icon="/Convertor;component/Images/logo256.ico" 
        TextOptions.TextFormattingMode="Display"
        Loaded="Window_Loaded" 
        Closing="Window_Closing" 
        KeyDown="Window_KeyDown" WindowState="Maximized">
    <Window.Resources>
        <local:TemplateListBGColorConverter x:Key="TemplateListBGColorConverter"/>
        <local:LogTypeToColorConverter x:Key="LogTypeToColorConverter"/>
        <local:TickToTimeStringConverter x:Key="TickToTimeStringConverter"/>
        <local:StringIsBindConverter x:Key="StringIsBindConverter"/>
        <local:ControlSizeConverter x:Key="ControlSizeConverter"/>
        <local:TemplateTypesConverter x:Key="TemplateTypesConverter"/>
        <local:TemplateListConverter x:Key="TemplateListConverter"/>
        <local:TemplateSplitNameConverter x:Key="TemplateSplitNameConverter"/>

        <conv:EnumFlagToCollapsedConverter x:Key="EnumFlagToCollapsedConverter"/>
        <conv:EnumToCollapsedConverter x:Key="EnumToCollapsedConverter"/>
    </Window.Resources>
    <Window.Background>
        <ImageBrush ImageSource="Images/Bg-1.png"/>
    </Window.Background>

    <Grid Background="{StaticResource MainBackgroundOpacityMask}">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <DockPanel>
            <DockPanel DockPanel.Dock="Top" Height="35" Background="Transparent" Margin="0,0,0,5">
                <DockPanel.Effect>
                    <DropShadowEffect ShadowDepth="3" Opacity="0.1"/>
                </DockPanel.Effect>
                <Menu DockPanel.Dock="Left" Padding="6" Width="220" HorizontalAlignment="Left" Margin="0,0,-2,0" Background="{StaticResource HeaderBGColor}" Foreground="{StaticResource MenuTopFontColor}">
                    <MenuItem Header="{DynamicResource MenuFile}" >
                        <MenuItem Header="{DynamicResource MenuNew}" Click="menuItem_NewTemplate_Click" Foreground="{StaticResource MenuSubFontColor}"/>
                        <MenuItem Header="{DynamicResource Open}" Foreground="{StaticResource MenuSubFontColor}">
                            <MenuItem Header="{DynamicResource Template}" Click="menuItem_OpenTemplate_Click"/>
                            <MenuItem Header="{DynamicResource File}" Click="menuItem_OpenInputText_Click"/>
                        </MenuItem>
                        <MenuItem Header="{DynamicResource MenuSave}" Click="menuItem_SaveToTempalte_Click" Foreground="{StaticResource MenuSubFontColor}">
                            <MenuItem.Icon>
                                <Image Source="Images/Save.png"></Image>
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="{DynamicResource SaveAs}" Click="menuItem_SaveTemplateAs_Click" Foreground="{StaticResource MenuSubFontColor}"/>
                        <MenuItem Header="{DynamicResource Exit}" Name="menuClose" Click="menuItem_CloseApp_Click" Foreground="{StaticResource MenuSubFontColor}"/>
                    </MenuItem>
                    <MenuItem Header="{DynamicResource MenuTools}">
                        <MenuItem Header="{DynamicResource Language}" Foreground="{StaticResource MenuSubFontColor}">
                            <MenuItem Header="English" Click="menuItem_ChangeLanguage_Click"/>
                            <MenuItem Header="Français" Click="menuItem_ChangeLanguage_Click"/>
                            <MenuItem Header="中文" Click="menuItem_ChangeLanguage_Click"/>
                        </MenuItem>
                        <MenuItem Header="{DynamicResource Setting}" Click="menuItem_Setting_Click" Foreground="{StaticResource MenuSubFontColor}">
                            <MenuItem.Icon>
                                <Image Source="Images/Setting.png"></Image>
                            </MenuItem.Icon>
                        </MenuItem>
                    </MenuItem>
                    <MenuItem Header="{DynamicResource MenuHelp}" Name="menuItem_Plugin">
                        <MenuItem Header="{DynamicResource Menu_HelpOnline}" Click="menuItem_Help_Click" Foreground="{StaticResource MenuSubFontColor}"/>
                        <MenuItem Header="{DynamicResource Menu_GetExample}" Click="menuItem_Example_Click" Foreground="{StaticResource MenuSubFontColor}"/>
                        <MenuItem Header="{DynamicResource Menu_CheckUpdate}" Click="menuItem_CheckUpdate_Click" Foreground="{StaticResource MenuSubFontColor}"/>
                        <MenuItem Header="{DynamicResource About}" Click="menuItem_ShowAbout_Click" Foreground="{StaticResource MenuSubFontColor}">
                            <MenuItem.Icon>
                                <Image Source="Images/Help.png"></Image>
                            </MenuItem.Icon>
                        </MenuItem>
                    </MenuItem>
                </Menu>
                <StackPanel DockPanel.Dock="Left" Width="60">
                    <StackPanel.Background>
                        <DrawingBrush Stretch="Fill">
                            <DrawingBrush.Drawing>
                                <GeometryDrawing Brush="{StaticResource HeaderBGColor}">
                                    <GeometryDrawing.Pen>
                                        <Pen Brush="Black" Thickness="0" />
                                    </GeometryDrawing.Pen>
                                    <GeometryDrawing.Geometry>
                                        <StreamGeometry>M80,81 L80,401 C80,401 99,401 99,401 150,401 206.58495,301.96032 236.74455,244.74375 269,183 309,103 401,102 401,102 401,81 401,81 401,81 80,81 80,81 z</StreamGeometry>
                                    </GeometryDrawing.Geometry>
                                </GeometryDrawing>
                            </DrawingBrush.Drawing>
                        </DrawingBrush>
                    </StackPanel.Background>
                </StackPanel>
                <StackPanel DockPanel.Dock="Left">
                    <StackPanel.Background>
                        <DrawingBrush AlignmentX="Left" AlignmentY="Top" TileMode="Tile" Stretch="None">
                            <DrawingBrush.Drawing>
                                <GeometryDrawing Brush="{StaticResource HeaderBGColor}">
                                    <GeometryDrawing.Geometry>
                                        <RectangleGeometry Rect="0,0,400000,2.3"/>
                                    </GeometryDrawing.Geometry>
                                </GeometryDrawing>
                            </DrawingBrush.Drawing>
                        </DrawingBrush>
                    </StackPanel.Background>

                    <Button Template="{StaticResource ButtonWithoutBackground}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,5,10,0" Padding="15,0,15,0" Click="btOutput_Click">
                        <WrapPanel>
                            <Image x:Name="imgOutput" Source="Images/Play.png" Width="30"/>
                            <TextBlock Name="btOutput" Text="{DynamicResource MenuOutput}" Margin="1,8,0,0"/>
                        </WrapPanel>
                    </Button>
                </StackPanel>
            </DockPanel>
            <DockPanel>
                <TabControl x:Name="tabLeft" DockPanel.Dock="Left" TabStripPlacement="Right"
                            Style="{StaticResource LeftTabControlStype}"
                            SelectedIndex="{Binding Source={x:Static local:Config.GlobalConfig}, Path=LeftTabIndex, UpdateSourceTrigger=PropertyChanged}">
                    <TabItem Style="{StaticResource LeftTabItemStyle}">
                        <TabItem.Header>
                            <WrapPanel>
                                <Image Source="Images/Up.png" Width="15" RenderTransformOrigin="0.5,0.5">
                                    <Image.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform/>
                                            <SkewTransform/>
                                            <RotateTransform Angle="180"/>
                                            <TranslateTransform/>
                                        </TransformGroup>
                                    </Image.RenderTransform>
                                </Image>
                                <TextBlock Text="{DynamicResource TabControlClose}" Margin="5,0,0,0"/>
                            </WrapPanel>
                        </TabItem.Header>
                    </TabItem>
                    <TabItem Style="{DynamicResource LeftTabItemStyle}">
                        <TabItem.Header>
                            <WrapPanel>
                                <Image Source="Images/Plugins.png" Width="15"/>
                                <TextBlock Text="{DynamicResource Template}" Margin="5,0,0,0"/>
                            </WrapPanel>
                        </TabItem.Header>
                        <Grid x:Name="gridLeft" Margin="-5">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="{Binding Source={x:Static local:Config.GlobalConfig}, Path=LeftChange, Converter={StaticResource ControlSizeConverter}}" />
                                <ColumnDefinition Width="0"/>
                            </Grid.ColumnDefinitions>
                            <DockPanel Grid.ColumnSpan="2" Margin="0">
                                <Image  DockPanel.Dock="Right" Source="Images/Up.png" Width="10" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,2,0,0" RenderTransformOrigin="0.5,0.5">
                                    <Image.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform/>
                                            <SkewTransform/>
                                            <RotateTransform Angle="90"/>
                                            <TranslateTransform/>
                                        </TransformGroup>
                                    </Image.RenderTransform>
                                </Image>
                                <DockPanel IsEnabled="{Binding Source={x:Static local:Config.GlobalConfig}, Path=IsConvertingStop}">
                                    <ComboBox x:Name="cbTemplateType" DockPanel.Dock="Top" Height="25" Padding="15,4,4,4" Margin="0,0,0,0"
                                                  ItemsSource="{Binding Source={x:Static local:Config.GlobalConfig}, Path=TemplateList, Converter={StaticResource TemplateTypesConverter}, Mode=OneWay}"
                                                  SelectedIndex="{Binding Source={x:Static local:Config.GlobalConfig}, Path=TemplateType, UpdateSourceTrigger=LostFocus}"
                                                  BorderBrush="{x:Null}" Background="{x:Null}" Foreground="#FF377DE2"/>
                                    <AdornerDecorator>
                                        <ListBox Name="lstTemplate"
                                            Style="{StaticResource NoneStyle}"
                                            HorizontalContentAlignment="Stretch" 
                                            AllowDrop="True"
                                            ContextMenuOpening="lstTemplate_ContextMenuOpening"
                                            MouseDoubleClick="lstTemplate_MouseDoubleClick"
                                            KeyDown="lstTemplate_KeyDown"
                                            Drop="lstTemplate_Drop" Margin="1" Background="#33FFFFFF">
                                            <ListBox.ItemsSource>
                                                <MultiBinding Converter="{StaticResource TemplateListConverter}" UpdateSourceTrigger="Explicit">
                                                    <Binding Source="{x:Static local:Config.GlobalConfig}" Path="TemplateList"/>
                                                    <Binding ElementName="cbTemplateType" Path="SelectedItem" />
                                                </MultiBinding>
                                            </ListBox.ItemsSource>
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <Border Margin="-2,0,-2,0" Padding="3">
                                                        <Border.Background>
                                                            <MultiBinding Converter="{StaticResource TemplateListBGColorConverter}" ConverterParameter="#FFFF6347,">
                                                                <Binding Path="CurrentTemplate.Container" Source="{StaticResource Config}"/>
                                                                <Binding Path="Name"/>
                                                                <Binding Path="UniqueId"/>
                                                                <Binding Path="Path"/>
                                                            </MultiBinding>
                                                        </Border.Background>
                                                        <WrapPanel>
                                                            <TextBlock Text="{Binding Path=Name, Converter={StaticResource TemplateSplitNameConverter}, ConverterParameter='Group'}" 
                                                                   ToolTip="{Binding Path=Description}">
                                                                <TextBlock.Foreground>
                                                                    <MultiBinding Converter="{StaticResource TemplateListBGColorConverter}" ConverterParameter="#FFDDDDDD,#FF377DE2">
                                                                        <Binding Path="CurrentTemplate.Container" Source="{StaticResource Config}"/>
                                                                        <Binding Path="Name"/>
                                                                        <Binding Path="UniqueId"/>
                                                                        <Binding Path="Path"/>
                                                                    </MultiBinding>
                                                                </TextBlock.Foreground>
                                                            </TextBlock>
                                                            <TextBlock Text="{Binding Path=Name, Converter={StaticResource TemplateSplitNameConverter}, ConverterParameter='Name'}" 
                                                                   ToolTip="{Binding Path=Description}">
                                                                <TextBlock.Foreground>
                                                                    <MultiBinding Converter="{StaticResource TemplateListBGColorConverter}" ConverterParameter="#FFFFFFFF,#FF000000">
                                                                        <Binding Path="CurrentTemplate.Container" Source="{StaticResource Config}"/>
                                                                        <Binding Path="Name"/>
                                                                        <Binding Path="UniqueId"/>
                                                                        <Binding Path="Path"/>
                                                                    </MultiBinding>
                                                                </TextBlock.Foreground>
                                                            </TextBlock>
                                                        </WrapPanel>
                                                    </Border>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                            <ListBox.ContextMenu >
                                                <ContextMenu>
                                                    <MenuItem Header="{DynamicResource MenuNew}" Click="menuItem_NewTemplate_Click"/>
                                                    <MenuItem x:Name="menuItemTLoadTemplate"  Header="{DynamicResource Load}" Click="menuItem_LoadTemplate_Click"/>
                                                    <MenuItem x:Name="menuItemTDeleteTemplate" Header="{DynamicResource Delete}" Click="menuItem_DeleteTemplate_Click">
                                                        <MenuItem.Icon>
                                                            <Image Source="Images/Delete.png" Width="15"></Image>
                                                        </MenuItem.Icon>
                                                    </MenuItem>
                                                    <MenuItem x:Name="menuImteTRenameTemplate" Header="{DynamicResource Rename}" Click="menuItem_RenameTemplate_Click"/>
                                                </ContextMenu>
                                            </ListBox.ContextMenu>
                                            <sm:WatermarkService.Titlemark>
                                                <TextBlock Text="{DynamicResource TemplateList}" TextAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,20,20"></TextBlock>
                                            </sm:WatermarkService.Titlemark>
                                        </ListBox>
                                    </AdornerDecorator>
                                </DockPanel>
                            </DockPanel>
                            <GridSplitter HorizontalAlignment="Right" VerticalAlignment="Stretch" ResizeDirection="Columns" Width="10" Opacity="0" DragCompleted="GridSplitter_Left_DragCompleted" Background="Transparent"/>
                        </Grid>
                    </TabItem>
                </TabControl>
                <TabControl x:Name="tabRight" DockPanel.Dock="Right" TabStripPlacement="Left"
                            UseLayoutRounding="True"
                            Style="{StaticResource RightTabControlStype}"
                            SelectedIndex="{Binding Source={x:Static local:Config.GlobalConfig}, Path=RightTabIndex, UpdateSourceTrigger=PropertyChanged}">
                    <TabItem Style="{StaticResource RightTabItemStyle}">
                        <TabItem.Header>
                            <WrapPanel>
                                <Image Source="Images/Up.png" Width="15" RenderTransformOrigin="0.5,0.5">
                                    <Image.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform/>
                                            <SkewTransform/>
                                            <RotateTransform Angle="180"/>
                                            <TranslateTransform/>
                                        </TransformGroup>
                                    </Image.RenderTransform>
                                </Image>
                                <TextBlock Text="{DynamicResource TabControlClose}" Margin="5,0,0,0"/>
                            </WrapPanel>
                        </TabItem.Header>
                    </TabItem>
                    <TabItem Style="{StaticResource RightTabItemStyle}">
                        <TabItem.Header>
                            <WrapPanel>
                                <Image Source="Images/Plugins.png" Width="15"/>
                                <TextBlock Text="{DynamicResource Plugins}" Margin="5,0,0,0"/>
                            </WrapPanel>
                        </TabItem.Header>
                        <local:ManagePluginControl x:Name="pluginControl" DockPanel.Dock="Right" IsEnabled="{Binding Source={x:Static local:Config.GlobalConfig}, Path=IsConvertingStop}"/>
                    </TabItem>
                </TabControl>
                <Border DockPanel.Dock="Left">
                    <Grid x:Name="GridInputOutput" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="{Binding Source={x:Static local:Config.GlobalConfig}, Path=VerticalChange, Converter={StaticResource ControlSizeConverter}}" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid Grid.Row="0">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition Height="10"/>
                            </Grid.RowDefinitions>
                            <AdornerDecorator Grid.Row="0">
                                <Border Style="{StaticResource BorderShadowStyle}">
                                    <TextBox x:Name="tbInput"
                                             Style="{StaticResource NoneStyle}"
                                             IsEnabled="{Binding Source={x:Static local:Config.GlobalConfig}, Path=IsConvertingStop}"
                                         Text="{Binding Source={StaticResource Config}, Path=CurrentTemplate.Container.InputText, UpdateSourceTrigger=PropertyChanged}"
                                         VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
                                         AllowDrop="True" AcceptsReturn="True" AcceptsTab="True" 
                                         TextChanged="tbInput_TextChanged" Margin="-6,4,6,-4">
                                        <sm:WatermarkService.Titlemark>
                                            <TextBlock Text="{DynamicResource InputContent}" TextAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,20,20"/>
                                        </sm:WatermarkService.Titlemark>
                                    </TextBox>
                                </Border>
                            </AdornerDecorator>
                            <Image Source="Images/Up.png" Width="12" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,2,0,0" RenderTransformOrigin="0.5,0.5">
                                <Image.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform Angle="180"/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Image.RenderTransform>
                            </Image>
                        </Grid>
                        <GridSplitter HorizontalAlignment="Stretch" VerticalAlignment="Bottom" ResizeDirection="Rows" Height="10" Opacity="0" DragCompleted="GridSplitter_DragCompleted"/>
                        <DockPanel Grid.Row="1">
                            <TabControl  x:Name="tabBottom"  DockPanel.Dock="Bottom" 
                                         Style="{StaticResource BottomTabControlStype}"
                                         SelectedIndex="{Binding Source={x:Static local:Config.GlobalConfig}, Path=BottomTabIndex}">
                                <TabItem Style="{StaticResource BottomTabItemStyle}">
                                    <TabItem.Header>
                                        <DockPanel>
                                            <Image Source="Images/Up.png" Width="15" RenderTransformOrigin="0.5,0.5">
                                                <Image.RenderTransform>
                                                    <TransformGroup>
                                                        <ScaleTransform/>
                                                        <SkewTransform/>
                                                        <RotateTransform Angle="180"/>
                                                        <TranslateTransform/>
                                                    </TransformGroup>
                                                </Image.RenderTransform>
                                            </Image>
                                            <TextBlock Text="{DynamicResource TabControlClose}" Margin="5,0,0,0"/>
                                        </DockPanel>
                                    </TabItem.Header>
                                </TabItem>
                                <TabItem Style="{StaticResource BottomTabItemStyle}"
                                    Visibility="{Binding Source={x:Static local:Config.GlobalConfig}, Path=UseWebExplorer, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=1}">
                                    <TabItem.Header>
                                        <DockPanel>
                                            <TextBlock Text="{DynamicResource ShowWithWeb}" Margin="5,0,0,0"/>
                                        </DockPanel>
                                    </TabItem.Header>
                                    <DockPanel MinHeight="200">
                                        <WebBrowser x:Name="wbOutput" behavior:BrowserBehavior.Html="{Binding ElementName=tbOutput, Path=Text, Mode=OneWay, Converter={StaticResource StringIsBindConverter}}"/>
                                    </DockPanel>
                                </TabItem>
                                <TabItem Style="{StaticResource BottomTabItemStyle}">
                                    <TabItem.Header>
                                        <DockPanel>
                                            <TextBlock Text="{DynamicResource LastOrignalText}" Margin="5,0,0,0"/>
                                        </DockPanel>
                                    </TabItem.Header>
                                    <AdornerDecorator>
                                        <TextBox Style="{StaticResource NoneStyle}" AcceptsReturn="True" AcceptsTab="True" BorderThickness="0"
                                             VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"  MinHeight="200"
                                             Text="{Binding Source={x:Static local:Config.GlobalConfig}, Path=LastInputContent}">
                                            <sm:WatermarkService.Titlemark>
                                                <TextBlock Text="{DynamicResource LastOrignalText}" TextAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,20,20"></TextBlock>
                                            </sm:WatermarkService.Titlemark>
                                        </TextBox>
                                    </AdornerDecorator>
                                </TabItem>
                                <TabItem Style="{StaticResource BottomTabItemStyle}"
                                         Visibility="{Binding Source={x:Static local:Config.GlobalConfig}, Path=IgnoreLog, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=0}">
                                    <TabItem.Header>
                                        <WrapPanel>
                                            <Image Source="Images/Calendar.png" Width="15"/>
                                            <TextBlock Text="{DynamicResource Log}" Margin="5,0,0,0"/>
                                        </WrapPanel>
                                    </TabItem.Header>
                                    <DockPanel MinHeight="200">
                                        <DockPanel DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" Background="#4CD8D8D8" Height="30">
                                            <WrapPanel VerticalAlignment="Center">
                                                <Button Margin="0,7,0,0" Template="{StaticResource ButtonWithoutBackground}" Padding="3"
                                                    VerticalAlignment="Center"
                                                    Click="Button_SaveLog_Click">
                                                    <WrapPanel>
                                                        <Image Source="Images/Save.png" Width="16"/>
                                                        <TextBlock Text="{DynamicResource Save}"/>
                                                    </WrapPanel>
                                                </Button>
                                            </WrapPanel>
                                            <WrapPanel DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center">
                                                <AdornerDecorator>
                                                    <TextBox Text="{Binding Source={x:Static local:Config.LogModel}, Path=Filter, UpdateSourceTrigger=PropertyChanged}"  Width="100" Padding="3">
                                                        <sm:WatermarkService.Titlemark>
                                                            <TextBlock Text="{DynamicResource Log_Filter}" TextAlignment="Right" VerticalAlignment="Center"></TextBlock>
                                                        </sm:WatermarkService.Titlemark>
                                                    </TextBox>
                                                </AdornerDecorator>
                                                <Button Content="&lt;&lt;" Template="{StaticResource ButtonWithoutBackground}" Width="16" Padding="0" Margin="0,0,5,0" Click="Button_Page_Click"/>
                                                <Button Content="&lt;" Template="{StaticResource ButtonWithoutBackground}" Width="8" Padding="0" Margin="0" Click="Button_Page_Click"/>
                                                <TextBox Text="{Binding Source={x:Static local:Config.LogModel}, Path=Page, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NoneStyle}" Padding="0" VerticalAlignment="Center"/>
                                                <TextBlock Text="/" VerticalAlignment="Center" Margin="0"/>
                                                <TextBlock Text="{Binding Source={x:Static local:Config.LogModel}, Path=PageCount, Mode=OneWay}" VerticalAlignment="Center" Margin="0" Padding="0"/>
                                                <Button Content="&gt;" Template="{StaticResource ButtonWithoutBackground}" Width="8" Padding="0" Click="Button_Page_Click"/>
                                                <Button Content="&gt;&gt;" Template="{StaticResource ButtonWithoutBackground}" Width="16" Padding="0" Margin="5,0,0,0" Click="Button_Page_Click"/>
                                                <TextBlock Text="{DynamicResource Log_PageSize}" VerticalAlignment="Center" Margin="5,0,5,0"/>
                                                <TextBox Text="{Binding Source={x:Static local:Config.LogModel}, Path=PageSize, UpdateSourceTrigger=PropertyChanged}" Padding="3"/>
                                                <TextBlock Text="{DynamicResource Log_TotalCount}" VerticalAlignment="Center" Margin="5,0,5,0"/>
                                                <TextBlock Text="{Binding Source={x:Static local:Config.LogModel}, Path=TotalCount, Mode=OneWay}" VerticalAlignment="Center"/>
                                            </WrapPanel>
                                        </DockPanel>
                                        <ScrollViewer VerticalScrollBarVisibility="Auto">
                                            <DataGrid x:Name="dataGridLog"
                                                      BorderThickness="0"
                                                  GridLinesVisibility="None" Background="{x:Null}"
                                                  AlternatingRowBackground="#FFE4E0E0"
                                                      AutoGenerateColumns="False"  IsReadOnly="True"
                                                  ItemsSource="{Binding Source={x:Static local:Config.LogModel}, Path=LogList, Mode=OneWay}">
                                                <DataGrid.CellStyle>
                                                    <Style TargetType="DataGridCell">
                                                        <Setter Property="Padding" Value="3"/>
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type DataGridCell}">
                                                                    <Border Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                                                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                                    </Border>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Setter Property="ToolTip" Value="{Binding Name}"/>
                                                    </Style>
                                                </DataGrid.CellStyle>
                                                <DataGrid.Columns>
                                                    <DataGridTemplateColumn Header="{DynamicResource Plugins}" Width="120" ClipboardContentBinding="{Binding Path=PluginName, Converter={StaticResource StringCompressConverter}}">
                                                        <DataGridTemplateColumn.CellTemplate>
                                                            <DataTemplate>
                                                                <TextBlock Text="{Binding Path=PluginName}"  Visibility="{Binding LogType, Converter={StaticResource EnumFlagToCollapsedConverter}, ConverterParameter={x:Static interface:LogTypes.HidePluginName}}"></TextBlock>
                                                            </DataTemplate>
                                                        </DataGridTemplateColumn.CellTemplate>
                                                    </DataGridTemplateColumn>
                                                    <DataGridTextColumn Header="{DynamicResource Time}" Width="100" Binding="{Binding Path=Date, StringFormat='{}{0:HH:mm:ss.ffff}'}"/>
                                                    <DataGridTemplateColumn Header="{DynamicResource Log}" Width="*" ClipboardContentBinding="{Binding Path=Log, Converter={StaticResource StringCompressConverter}}">
                                                        <DataGridTemplateColumn.CellTemplate>
                                                            <DataTemplate>
                                                                <TextBlock Text="{Binding Path=Log}" ToolTip="{Binding Path=Log}" Foreground="{Binding LogType, Converter={StaticResource LogTypeToColorConverter}}"></TextBlock>
                                                            </DataTemplate>
                                                        </DataGridTemplateColumn.CellTemplate>
                                                    </DataGridTemplateColumn>
                                                </DataGrid.Columns>
                                            </DataGrid>
                                        </ScrollViewer>
                                    </DockPanel>
                                </TabItem>
                            </TabControl>
                            <AdornerDecorator>
                                <Border Style="{StaticResource BorderShadowStyle}">
                                    <TextBox x:Name="tbOutput" 
                                         Style="{StaticResource NoneStyle}" AcceptsReturn="True" AcceptsTab="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
                                         Text="{Binding Source={x:Static local:Config.GlobalConfig}, Path=ConvertedContent}">
                                        <sm:WatermarkService.Titlemark>
                                            <TextBlock Text="{DynamicResource OutputContent}" TextAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,20,20"></TextBlock>
                                        </sm:WatermarkService.Titlemark>
                                    </TextBox>
                                </Border>
                            </AdornerDecorator>
                        </DockPanel>
                    </Grid>
                </Border>
            </DockPanel>
        </DockPanel>
        <StatusBar Grid.Row="1" Background="#FFDAE5F0" Margin="0,5,0,0">
            <StatusBarItem
                           Visibility="{Binding Source={x:Static local:Config.GlobalConfig}, Path=ExceptionTime, Converter={StaticResource EnumToCollapsedConverter}, ConverterParameter=0}" >
                <Border BorderBrush="White" BorderThickness="1,1,1,1" CornerRadius="50"
                        HorizontalAlignment="Center" Margin="0,0,0,0" Background="Red" Padding="3" MinWidth="20"
                        MouseDown="AppErrorIcon_MouseDown">
                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" ToolTip="App Error Times" Foreground="White" FontSize="12" FontWeight="Bold"
                               Text="{Binding Source={x:Static local:Config.GlobalConfig}, Path=ExceptionTime}" />
                </Border>
            </StatusBarItem>
            <StatusBarItem>
                <ProgressBar Name="progressBar1" HorizontalAlignment="Right" Width="100" Height="10" Visibility="Collapsed" Maximum ="100" Minimum="0" Value="0"/>
            </StatusBarItem>
            <StatusBarItem>
                <TextBlock Text="{Binding Source={StaticResource Config}, Path=ProcesingPluginNameModel.ShowModified}"/>
            </StatusBarItem>
            <StatusBarItem>
                <TextBlock Text="{Binding Source={StaticResource Config}, Path=CurrentTemplate.Container.Name}"/>
            </StatusBarItem>
            <StatusBarItem>
                <TextBlock Margin="5,0,0,0" Text="{Binding Source={StaticResource Config}, Path=ProcesingPluginNameModel.ProcessingPluginName}"/>
            </StatusBarItem>
            <StatusBarItem HorizontalAlignment="Right">
                <TextBlock Margin="5,0,0,0" DockPanel.Dock="Right" Text="{Binding Source={x:Static local:Config.GlobalConfig}, Path=DurringTime, Converter={StaticResource TickToTimeStringConverter}}"/>
            </StatusBarItem>
        </StatusBar>

    </Grid>
</Window>
